#include "stdafx.h"
#include "net/StringPartSource.hpp"

NET_NAMESPACE_BEGIN

CStringPartSource::CStringPartSource(const std::string& str) : CPartSource("text/plain"), m_istr(str)
{
}

CStringPartSource::CStringPartSource(const std::string& str, const std::string& mediaType) : CPartSource(mediaType), m_istr(str)
{
}

CStringPartSource::CStringPartSource(const std::string& str, const std::string& mediaType, const std::string& filename)
	: CPartSource(mediaType),
	m_istr(str),
	m_filename(filename)
{
}

CStringPartSource::~CStringPartSource()
{
}


std::istream& CStringPartSource::stream()
{
	return m_istr;
}

const std::string& CStringPartSource::filename() const
{
	return m_filename;
}

std::streamsize CStringPartSource::getContentLength() const
{
	return m_istr.str().length();
}

NET_NAMESPACE_END
